-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Authentication favorites #253
base: authorization
Are you sure you want to change the base?
Conversation
…umentation for 'forbidden' was added, a method that was not going to be used was removed and an import was removed
…to authentication-favorites
…to authentication-favorites
…piForbiddenResponse'
…piForbiddenResponse'
…ion for 'ApiUnaunthorizeResponse' and 'ApiBadRequestResponse'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revisar las conversaciones que no estan resueltas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tambien quedaron dos conversaciones sin resolver
async create(body: CreateFavoriteDto, user: User): Promise<void> { | ||
const itemExist = await this.itemRepo.findOne(body.itemId); | ||
|
||
if (!itemExist) { | ||
throw new UnprocessableEntityException('Item does not exist'); | ||
} | ||
|
||
const preFavorite: any = { ...body, user: user }; | ||
|
||
const newFavorite = this.favoritesRepo.create(preFavorite); | ||
|
||
await this.favoritesRepo.save(newFavorite); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- falta asignarle el item al favorito
- hay que comprobar que no se pueda agregar el mismo favorito dos veces
- cuando el item no existe esta tirando la excepcion bien pero no lo esta manejando nest por lo que devuelve 201 igual
name: 'id', | ||
type: Number, | ||
required: true, | ||
description: 'The ID of the Favorite record to delete.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revisar description
if (ability.cannot(Permission.Read, subject('Favorite', favorite))) { | ||
throw new ForbiddenException(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
esta rebotando todas las peticiones, incluso cuando no tendria que hacerlo
Autenticacion en el modulo favorites
Para completar la tarea se agrego lo siguiente: